function panel(config){
    var cover = document.createElement("div")
    cover.classList.add("cover")
    var panel = document.createElement("div")
    this.cover = cover
    this.panel = panel
    document.body.appendChild(this.cover)
    document.body.appendChild(this.panel)
    panel.style.right="-" + (config.width || "500px")
    panel.classList.add("cover-panel")
    panel.style.right = "0";
    panel.style.width = config.width || "500px"
    var header = document.createElement("div")
    header.classList.add("header")
    header.innerHTML = config.title || ''
    panel.appendChild(header)

    var content = document.createElement("div")
    content.classList.add("content")
    content.innerHTML = config.html || ''
    panel.appendChild(content)

    var that = this
    this.cover.addEventListener("click",function (ev) {
        document.body.removeChild(that.cover)
        document.body.removeChild(that.panel)
    })

}
panel.prototype.close = function(){
    document.body.removeChild(this.cover)
    document.body.removeChild(this.panel)
}